package com.huiquan.foundation.constant;

import com.huiquan.framework.constant.BaseContants;

/**
 * @author rocky xu
 * @Description:页面中选项卡的ID
 */
public enum TabID {

    SYNONYMY("1", "同义词"),

    SYNONYMY_ELEMENT("1_1", "小词同义词"),

    SYNONYMY_SLANG("1_2", "大白话同义词"),

    ANALYSIS_ZS("11", "主诉"),

    ANALYSIS_XBS("12", "现病史"),

    ANALYSIS_CT("13", "医学影像标注"),

    ANALYSIS_DI("30", "诊断"),

    ANALYSIS_CT_UNLABELED("13_0", "医学影像未标注"),

    ANALYSIS_CT_LABELED("13_1", "医学影像已标注"),

    ANALYSIS_CT_HALF_LABELED("13_2", "医学影像半标注"),

    VOCAB_ELEMENT_UNCHECKED("21_0", "小词待校验"),

    VOCAB_ELEMENT_RIGHT("21_1", "小词正确"),

    VOCAB_ELEMENT_WRONG("21_2", "小词错误"),

    VOCAB_ELEMENT_REPLACE("21_3", "小词替换"),

    VOCAB_ELEMENT_SLANG("21_4", "小词大白话"),

    VOCAB_ELEMENT_WILDCARD("21_5", "小词通配符"),

    VOCAB_ELEMENT_SEX_AGE("21_6", "小词年龄性别"),

    CHECK_SENTENCE_UNCHECKED("22_0", "人工校验语句未校验"),

    CHECK_SENTENCE_CHECKED("22_0", "人工校验语句已标注");

    private String id;

    private String desc;

    private TabID(String id, String desc) {
        this.id = id;
        this.desc = desc;
    }

    public boolean idEquals(String id) {
        return this.id.equals(id);
    }

    public String getDesc() {
        return desc;
    }

    public String getId() {
        return id;
    }

    /**
     * 是否为主诉模块
     *
     * @param tabid
     * @return
     */
    public static boolean isAnalysisZs(String tabid) {
        return tabid.startsWith(ANALYSIS_ZS.id + "_");
    }

    /**
     * 是否为现病史模块
     *
     * @param tabid
     * @return
     */
    public static boolean isAnalysisXbs(String tabid) {
        return tabid.startsWith(ANALYSIS_XBS.id + "_");
    }

    /**
     * 是否为诊断模块
     *
     * @param tabid
     * @return
     */
    public static boolean isAnalysisDi(String tabid) {
        return tabid.startsWith(ANALYSIS_DI.id + "_");
    }

    /**
     * 是否为医学影像模块
     *
     * @param tabid
     * @return
     */
    public static boolean isAnalysisCt(String tabid) {
        return tabid.startsWith(ANALYSIS_CT.id + "_");
    }

    /**
     * 得到子标签status
     *
     * @param tabid
     * @return
     */
    public static int getAnalysisLabelStatus(String tabid) {
        return Integer.parseInt(tabid.split("_")[1]);
    }

    public static Integer getElementFlagByTabID(String tabid) {
        Integer flag = BaseContants.FLAG_NULL;
        if (VOCAB_ELEMENT_RIGHT.getId().equals(tabid)) {
            flag = BaseContants.FLAG_RIGHT;
        } else if (VOCAB_ELEMENT_WRONG.getId().equals(tabid)) {
            flag = BaseContants.FLAG_WRONG;
        } else if("30_1".equals(tabid)){
            flag = BaseContants.FLAG_RIGHT;
        }else if("30_2".equals(tabid)){
            flag = BaseContants.FLAG_WRONG;
        }
        return flag;
    }
}
